<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        var obj = {
            name : "obj",
            age : 18,
            gender : "男"
        };
        //Json
        //JSON全称JavaScript Object Notation
        
        //对象转换为JSON
        var json = JSON.stringify(obj);
        console.log(json);
        console.log(typeof json);
        console.log(json.name);

        //JSON转换为对象
        var obj2 = JSON.parse(json);
        console.log(obj2);
        console.log(typeof obj2);
        console.log(obj2.name);

        

    </script>
</head>
<body>
    
</body>
</html>